import "../css/KafkaSQL-BI9QK6Bt.css";
import { _ as q } from "./kafka.vue_vue_type_script_setup_true_lang.DrTjPANP.js";
import { C as I } from "./main.DDNsfpKl.js";
import { defineComponent as Q, toRefs as R, ref as k, reactive as E, onMounted as T, openBlock as V, createElementBlock as F, createTextVNode as c, createVNode as l, unref as e, withCtx as a, createElementVNode as B, Fragment as K, renderList as j, createBlock as A } from "vue";
import { b as f, r as G, p as H, aX as J, B as M, C as g, aY as S, e as O, j as X, k as Y } from "./vendor.CF2kwqqq.js";
import { _ as $ } from "./_plugin-vue_export-helper.CHgC5LLL.js";
const z = [
  { label: "string", value: "string" },
  { label: "boolean", value: "boolean" },
  { label: "date", value: "date" },
  { label: "timestamp", value: "timestamp" },
  { label: "double", value: "double" },
  { label: "float", value: "float" },
  { label: "integer", value: "integer" },
  { label: "long", value: "long" },
  { label: "short", value: "short" }
], P = { class: "nifi-field" }, W = { class: "field_content" }, Z = { class: "allocation_footer" }, ee = /* @__PURE__ */ Q({
  __name: "index",
  props: {
    formdata: {},
    propOutput: {},
    graphShadow: {},
    inputV: {}
  },
  setup(p) {
    const x = p, { formdata: b, inputV: w, graphShadow: _ } = R(x), m = k(!1), r = () => {
      m.value = !0, s.tableData = [..._.value.get(b.value.id).tableData];
    }, s = E({
      tableData: [...w.value]
    }), v = () => {
      s.tableData.push({
        doc: "",
        name: "",
        type: ""
      });
    }, d = () => {
      m.value = !1;
    }, y = (u) => {
      s.tableData.splice(u, 1);
    }, C = k(), h = E({
      name: [{ required: !0, message: "字段名不能为空", trigger: "blur" }],
      // doc: [{ required: true, message: "字段中文名不能为空", trigger: "blur" }],
      type: [{ required: !0, message: "字段类型不能为空", trigger: "change" }]
    }), U = async () => {
      var u;
      await ((u = C.value) == null ? void 0 : u.validate((i, o) => {
        i ? (D(), d()) : console.log("error submit!", o);
      }));
    }, D = () => {
      _.value.set(b.value.id, "tableData", s.tableData);
    }, L = (u, i) => {
      u.name = i.target.value.trim();
    }, N = (u, i) => {
      u.doc = i.target.value.trim();
    };
    return T(() => {
      D();
    }), (u, i) => (V(), F("div", P, [
      c(" 字段设置 "),
      l(e(f), {
        type: "primary",
        onClick: r,
        style: { "margin-left": "12px" }
      }, {
        default: a(() => [
          c(" 字段设置 ")
        ]),
        _: 1
      }),
      l(e(G), {
        modelValue: m.value,
        "onUpdate:modelValue": i[0] || (i[0] = (o) => m.value = o),
        title: "字段设置",
        "destroy-on-close": "",
        "w-40vw": "",
        "h-70vh": "",
        "before-close": d
      }, {
        default: a(() => [
          l(e(f), {
            type: "primary",
            icon: e(H),
            onClick: v
          }, {
            default: a(() => [
              c(" 添加字段 ")
            ]),
            _: 1
          }, 8, ["icon"]),
          B("div", W, [
            l(e(J), {
              ref_key: "formRef",
              ref: C,
              model: s,
              rules: h,
              "label-width": "108px",
              inline: !0
            }, {
              default: a(() => [
                l(e(M), {
                  "max-height": "400",
                  data: s.tableData,
                  "cell-style": { textAlign: "center" },
                  "header-cell-style": { "text-align": "center" }
                }, {
                  default: a(() => [
                    l(e(g), {
                      prop: "name",
                      label: "字段名",
                      "show-overflow-tooltip": ""
                    }, {
                      default: a(({ $index: o, row: n }) => [
                        l(e(S), {
                          prop: "tableData." + o + ".name",
                          rules: h.name
                        }, {
                          default: a(() => [
                            l(e(O), {
                              modelValue: n.name,
                              "onUpdate:modelValue": (t) => n.name = t,
                              placeholder: "请输入",
                              class: "item__input",
                              clearable: "",
                              onBlur: (t) => L(n, t)
                            }, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 1
                    }),
                    l(e(g), {
                      prop: "doc",
                      label: "字段中文名",
                      "show-overflow-tooltip": ""
                    }, {
                      default: a(({ $index: o, row: n }) => [
                        l(e(S), {
                          prop: "tableData." + o + ".doc",
                          rules: h.doc
                        }, {
                          default: a(() => [
                            l(e(O), {
                              modelValue: n.doc,
                              "onUpdate:modelValue": (t) => n.doc = t,
                              placeholder: "请输入",
                              class: "item__input",
                              clearable: "",
                              onBlur: (t) => N(n, t)
                            }, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 1
                    }),
                    l(e(g), {
                      prop: "type",
                      label: "字段类型",
                      "show-overflow-tooltip": ""
                    }, {
                      default: a(({ $index: o, row: n }) => [
                        l(e(S), {
                          prop: "tableData." + o + ".type",
                          rules: h.type
                        }, {
                          default: a(() => [
                            l(e(X), {
                              modelValue: n.type,
                              "onUpdate:modelValue": (t) => n.type = t,
                              placeholder: "请选择",
                              class: "item__input",
                              filterable: "",
                              clearable: "",
                              "popper-class": "select_popper"
                            }, {
                              default: a(() => [
                                (V(!0), F(K, null, j(e(z), (t) => (V(), A(e(Y), {
                                  label: t.label,
                                  value: t.value
                                }, null, 8, ["label", "value"]))), 256))
                              ]),
                              _: 2
                            }, 1032, ["modelValue", "onUpdate:modelValue"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 1
                    }),
                    l(e(g), { label: "操作" }, {
                      default: a(({ $index: o }) => [
                        l(e(f), {
                          text: "",
                          onClick: () => y(o),
                          style: { "margin-bottom": "18px" }
                        }, {
                          default: a(() => [
                            c(" 删除 ")
                          ]),
                          _: 2
                        }, 1032, ["onClick"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }, 8, ["data"])
              ]),
              _: 1
            }, 8, ["model", "rules"])
          ]),
          B("div", Z, [
            l(e(f), { onClick: d }, {
              default: a(() => [
                c("取消")
              ]),
              _: 1
            }),
            l(e(f), {
              type: "primary",
              onClick: U
            }, {
              default: a(() => [
                c("保存")
              ]),
              _: 1
            })
          ])
        ]),
        _: 1
      }, 8, ["modelValue"])
    ]));
  }
}), le = /* @__PURE__ */ $(ee, [["__scopeId", "data-v-e8082cf8"]]), ae = (p) => ({
  graphShadow: p.graphShadow,
  cell: p.cell
}), pe = () => {
  let p = [];
  return { name: ["org.apache.nifi.kafka.sql.processors.KafkaSQL_1_0"], excludeKeys: [
    "topic",
    "bootstrap.servers",
    "input字段（自动填入）",
    "output字段（自动填入）",
    "web预留（自动填入）",
    "SQL语句"
  ], selfFormColumn: [
    {
      tag: q,
      ":formdata": "formData",
      prop: "config.properties",
      isFormElem: !1,
      label: "",
      ":data": "formData",
      setup({ params: r }) {
        return { graphShadowCell: ae(r) };
      },
      ":graphShadowCell": "graphShadowCell"
    },
    {
      tag: le,
      ":formdata": "formData",
      propOutput: "config.properties['output字段（自动填入）']",
      setup({ params: r }) {
        return {
          inputV: p,
          graphShadow: r.graphShadow
        };
      },
      ":inputV": "inputV",
      ":graphShadow": "graphShadow",
      style: "margin-bottom: 18px"
    },
    {
      prop: "config.properties.SQL语句",
      tag: I,
      style: "min-height: 100px",
      maxHeight: "100px",
      dialogTitle: "SQL语句",
      isFormElem: !0,
      label: "sql语句",
      elFormItem: { class: "flex-column" },
      setup({ params: r }) {
        return {
          readOnly: r.step.value === "running"
        };
      },
      ":readOnly": "readOnly"
    }
  ], hooksOpen: (r, s) => {
    p = [];
    let { source: v } = s.event, d = v.get(r.id).component.config.properties[
      // "output字段（自动填入）"
      "input字段（自动填入）"
    ];
    p = d ? JSON.parse(d).filter(
      (y) => !y.originalValue
    ) : [];
  }, hooksSubmit: (r, s) => {
  } };
};
export {
  pe as default
};
